/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view.GUI.actions;

import controller.commands.EditStoreCommand;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import model.graphic.objects.GNode;
import view.GUI.LabelReader;
import view.GUI.graphic.GraphicView;

/**
 *
 * @author Jelle
 */
public class EditStoreAction extends AbstractAction {

    private GraphicView gview;
    private JFrame frame;
    private GNode store;

    public EditStoreAction(GraphicView gview, JFrame frame, GNode store) {
        this.gview = gview;
        this.frame=frame;
        this.store=store;
    }

    public void actionPerformed(ActionEvent e) {
        String[] possibilities = {Object.class.getName(), String.class.getName(), Integer.class.getName(), Double.class.getName(), Boolean.class.getName()};
        String c = (String)JOptionPane.showInputDialog(
                    gview.getParent(),
                    LabelReader.getInstance().getString("WhichClassQuestion"),
                    LabelReader.getInstance().getString("ChooseAClass"),
                    JOptionPane.PLAIN_MESSAGE, null,
                    possibilities, Object.class
                 );
         gview.notifyObservers(new EditStoreCommand(store, c));
    }
}